import window from '@ohos.window';
import dict from '../common/core/dict';
import utils from '../common/core/utils';
import logger from '../common/core/logger';
import UIAbility from '@ohos.app.ability.UIAbility';

export default class EntryDetailAbility extends UIAbility {
  onCreate(want) {
    try {
      let aid = want?.parameters?.remoteData?.aid;
      if (utils.isEmpty(aid))
        aid = want?.parameters?.aid;
      globalThis.aid = aid.toString();
      let cid = want?.parameters?.remoteData?.cid;
      globalThis.cid = cid;
    } catch (e) {
      logger.error(e);
    }
  }

  onWindowStageCreate(windowStage: window.WindowStage) {
    try {
      utils.setLayoutFullScreen(windowStage, dict.COLOR_WHITE, dict.COLOR_BLACK, dict.COLOR_LIKE_WHITE, dict.COLOR_BLACK);
      windowStage.loadContent('pages/Play');
    } catch (e) {
      logger.error(e);
    }
  }
}